package com.sh.data.engine.domain.dataasset.model.domain;

import com.google.common.collect.Lists;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * @Version 1.0 @Author:xinyan @Date:2022/5/18 @Content:
 */
@Data
@NoArgsConstructor
public class DataAssetCountDomain {

    private List<Theme> themes;

    @Data
    @Builder(toBuilder = true)
    public static class Theme {

        private String name;

        private String count;
    }

    public DataAssetCountDomain(Map<String, Integer> map) {
        this.themes = Lists.newArrayList();
        map.forEach(
            (k, v) -> this.themes.add(Theme.builder().name(k).count(String.valueOf(v)).build()));
    }
}
